/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package concurrent.mergesort;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Iaroslav_Mazai
 */
public class Runner {

	private static final Integer ARRAY_SIZE = 10000;
	private static final Integer ARRAY_VALUE_CAP = 100000;

	public static void main(String[] args) {
		List<Object> list = generateTestData();

		System.out.println("Before sorting: ");
		System.out.println(list);

		ValueReturningRunnable<List<Object>> mainRunnable = new ComputationalUnit(list);
		Thread mainThread = new Thread(mainRunnable);
		mainThread.start();
		try {
			mainThread.join();
		} catch (InterruptedException ex) {
		}

		System.out.println("After sorting: ");
		System.out.println(mainRunnable.getValue());
	}

	private static List generateTestData() {
		List data = MergeSortUtils.generateRandomList(ARRAY_SIZE, ARRAY_VALUE_CAP);
		return data;
	}
}
